<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div class="app">
        <h1>标题</h1>
        <h1 v-if="showTitle">新的标题</h1>
        <button v-for="i in n" @click="addTitle">点击新增一行标题</button>
        <hr>
        <button @click="add">点击新增一个按钮</button>
    </div>
    <script>
        new Vue({
            el:".app",
            data:{
                showTitle:false,
                n:1
            },
            methods: {
                addTitle(){
                    this.showTitle=true
                },
                add(){
                    this.n++;
                }
            },
        })
    </script>
</body>
</html>